package com.fasteat.menu.entity.client;

import com.fasteat.common.entity.GlobalException;
import com.fasteat.common.entity.StatusCode;
import io.swagger.annotations.ApiModelProperty;

/**
 * @author run
 * @since 2021/2/20 14:06
 */
public class MenuSearchMap {

    @ApiModelProperty(value = "评论排序，0、默认方式，1、菜谱评论数升序，2、菜谱评论数降序")
    private int commentSort;

    @ApiModelProperty(value = "点赞数排序，0、默认方式，1、菜谱点赞数升序，2、菜谱点赞数降序")
    private int praiseSort;

    @ApiModelProperty(value = "时间排序，0、默认方式，1、时间升序，2、时间降序")
    private int timeSort;

    public int getCommentSort() {
        return commentSort;
    }

    public void setCommentSort(int commentSort) {
        if (commentSort < 0 || commentSort > 2){
            throw new GlobalException(StatusCode.ERROR,"评论排序参数不合法");
        }
        this.commentSort = commentSort;
    }

    public int getPraiseSort() {
        return praiseSort;
    }

    public void setPraiseSort(int praiseSort) {
        if (praiseSort < 0 || praiseSort > 2){
            throw new GlobalException(StatusCode.ERROR,"点赞数排序参数不合法");
        }
        this.praiseSort = praiseSort;
    }

    public int getTimeSort() {
        return timeSort;
    }

    public void setTimeSort(int timeSort) {
        if (timeSort < 0 || timeSort > 2){
            throw new GlobalException(StatusCode.ERROR,"时间排序参数不合法");
        }
        this.timeSort = timeSort;
    }
}
